<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>用户添加修改</title>
    <link href="bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet" th:href="@{/bootstrap-3.3.7-dist/css/bootstrap.min.css}">
    <link href="css/common.css" rel="stylesheet" th:href="@{/css/common.css}">
    <script type="text/javascript" src="js/jquery-1.12.4.min.js" th:src="@{/js/jquery-1.12.4.min.js}"></script>
    <script src="bootstrap-3.3.7-dist/js/bootstrap.min.js" th:src="@{/bootstrap-3.3.7-dist/js/bootstrap.min.js}"></script>
    <script src="jquery-validation-1.14.0/lib/jquery.js" th:src="@{/jquery-validation-1.14.0/lib/jquery.js}"></script>
    <script src="jquery-validation-1.14.0/dist/jquery.validate.min.js" th:src="@{/jquery-validation-1.14.0/dist/jquery.validate.min.js}"></script>
    <script type="text/javascript">
        $(function() {})
        $(document).ready(function() {
            $("#inputForm").validate({
                rules : {
                    username: {
                        required : true
                    },
                    oldPassword: {
                        required : true
                    },
                    newPassword: {
                        required : true
                    },
                    againPassword: {
                        required : true,
                        equalTo: "#newPassword"
                    },
                },
                messages : {
                    username: {
                        required : "用户名必填"
                    },
                    oldPassword: {
                        required : "请输入旧秘密"
                    },
                    newPassword: {
                        required : "请输入新密码"
                    },
                    againPassword: {
                        required : "请输入确认密码",
                        equalTo:"密码不匹配"
                    },
                }
            })
        });
    </script>
</head>

<body>
    <br>
    <!--
    <ol class="breadcrumb">
        <li class="active">添加数据</li>
    </ol>-->
<div class="container-fluid"><br>
    <form id="inputForm" action="/admin/sys/user/savePassword" method="post" class="form-horizontal"  enctype="multipart/form-data">
        <input type="hidden" name="id" th:value="${user.id}" />
        <div class="form-group" id="username">
            <label for="username" class="col-sm-1 control-label">用户名<b class="error">*</b></label>
            <div class="col-sm-6">
                <input name="username" th:value="${user.username}" readonly="readonly" maxlength="255" class="form-control"/>
            </div>
        </div>

        <div class="form-group" id="password">
            <label for="password" class="col-sm-1 control-label">旧密码<b class="error">*</b></label>
            <div class="col-sm-6">

                <input name="oldPassword" type="password"  th:value="${oldPassword}" htmlEscape="false" maxlength="255" class="form-control "/>
            </div>
        </div>
        
         <div class="form-group" id="password">
            <label for="password" class="col-sm-1 control-label">新密码<b class="error">*</b></label>
            <div class="col-sm-6">

                <input id="newPassword" name="newPassword" th:value="${newPassword}" type="password" htmlEscape="false" maxlength="255" class="form-control "/>
            </div>
        </div>
        
         <div class="form-group" id="password">
            <label for="password" class="col-sm-1 control-label">确认密码<b class="error">*</b></label>
            <div class="col-sm-6">

                <input name="againPassword" type="password" th:value="${againPassword}" htmlEscape="false" maxlength="255" class="form-control "/>
            </div>
        </div>
        
         
        
        <div class="form-group" id="roleSelect">
            <label class="col-sm-1 control-label"></label>
            <div class="col-sm-6">
               <button class="btn btn-success" type="submit">保 存</button>
                <button class="btn btn-inf" type="button" onclick="javascript:history.go(-1);">返 回</button>
            	<span style="color: red;" th:text="${msg}"></span>
            </div>
        </div>

    </form>
    </div>
</body>

</html>